//tab切换
var a = 0,b=0;
var li=$(".tab ul li");
li.click(function() {
	a=0;
	for (var i = 0; i < li.length-1; i++) {
		li.css({
			"color": "#000",
			"background-color": "#f2f2f2",
			"border-right": "1px solid #dcdcdc"
		})
		$(".slider_list").eq(i).removeClass("show");
	}
	$(".slider_list").eq(a).addClass("show")
	if($(this).index()<=li.length-2){
		$(this).css({
			"color": "#93c1e4",
			"background-color": "#fff",
			"border-right": "0"
		})
	}
	
	if ($(this).index() == 0) {
		li.eq(1).find("img").attr("src", "../../img/icon/huxing-5.png")
		li.eq(2).find("img").attr("src", "../../img/icon/ditu-2-copy.png")
		$(this).find("img").attr("src", "../../img/icon/tupian-1.png")
		b=0;
	}
	if ($(this).index() == 1) {
		li.eq(0).find("img").attr("src", "../../img/icon/tupian-1copy.png")
		li.eq(2).find("img").attr("src", "../../img/icon/ditu-2-copy.png")
		$(this).find("img").attr("src", "../../img/icon/huxing-5copy.png")
		b=1;
	}
	if ($(this).index() == 2) {
		li.eq(b).css({
			"color": "#93c1e4",
			"background-color": "#fff",
			"border-right": "0"
		})
		if(b==0){
			li.eq(0).find("img").attr("src", "../../img/icon/tupian-1.png")
		}else{
			li.eq(1).find("img").attr("src", "../../img/icon/huxing-5copy.png")
		}
		$(".slider_list").eq(a).addClass("show")
		window.scrollTo(0,960);
	}
})


//图片切换上一页
$(".prev img").click(function() {
	if (a <= 0) {
		a = $(".show .ul_list ul li").length;
		$(".show ul").css("margin-left", -(a * 396) + "px")
	}
	$(".show ul").css({
		"margin-left": -((a - 1) * 396) + "px",
		"transition": "0.3s all linear"
	});
	a--;
})


//图片切换下一页
$(".next img").click(function() {
	a++;
	if (a >= $(".show ul li").length) {
		a = 0;
	}
	$(".show ul").css({
		"margin-left": -(a * 396) + "px",
		"transition": "0.3s all linear"
	});
})

$(".seeroom").click(function() {
	location.href = "preset.jsp"
})

//收藏
var i = 0;
$(".Details_box1 p span:first-child").click(function() {
	if (i == 0) {
		$(this).find("img").attr("src", "../../img/icon/aixin.png")
		i = 1;
	} else {
		$(this).find("img").attr("src", "../../img/icon/shoucang-1.png")
		i = 0;
	}
})

$("#qZone").on("click", function() {
	$(this).socialShare("qZone");
})

//地图引用
var map = new BMap.Map("l-map");
var point = new BMap.Point(106.688442, 26.565431);
map.centerAndZoom(point, 12);
var marker = new BMap.Marker(point); // 创建标注
map.addOverlay(marker); // 将标注添加到地图中
marker.disableDragging();
map.enableScrollWheelZoom();
map.disableDragging();
map.disableScrollWheelZoom();




$(".btn_box button:nth-of-type(2)").click(function(){
	if($(".questions_box textarea").val()!=""){
		$(".questions_box textarea").val("");
		$(".questions_box").css("display","none")
		alert("发布成功")
	}else{
		alert("发布内容不可以为空")
	}
})

$(".questions_box_title img").click(function(){
	$(".questions_box").css("display","none")
})
$(".for_questions").click(function(){
	$(".questions_box").css("display","block")
})